/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package wwg;


import javax.swing.UIManager;
import javax.swing.table.DefaultTableModel;
import wwg.infoTools.clan.clan;
import wwg.infoTools.members.member;
import wwg.infoTools.members.members;

/**
 *
 * @author CmptrPrgmr
 */
public class MainApplication extends javax.swing.JFrame {

	DefaultTableModel model = new DefaultTableModel();
	
	/**
	 * Creates new form MainApplication
	 */
	public MainApplication() {
		initComponents();
		getClanInfo();
		setMemberInfo();
	}

	/**
	 * This method is called from within the constructor to initialize the form. WARNING: Do NOT
	 * modify this code. The content of this method is always regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        clanEmblemLabel = new javax.swing.JLabel();
        clanStatsPanel = new javax.swing.JPanel();
        clanExpLabel = new javax.swing.JLabel();
        clanExpToNextLevelLabel = new javax.swing.JLabel();
        clanHoursPlayedLabel = new javax.swing.JLabel();
        clanKillDeathRatioLabel = new javax.swing.JLabel();
        clanMemberCountLabel = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        clanLevelLabel = new javax.swing.JLabel();
        clanOwnerLabel = new javax.swing.JLabel();
        clanCreatorLabel = new javax.swing.JLabel();
        clanNameLabel = new javax.swing.JLabel();
        clanTagLabel = new javax.swing.JLabel();
        clanMottoLabel = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable(model);
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setName("World Wide Gmrz - WWG | CmptrGmr/CmptrPrgmr");
        setResizable(false);

        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Clan Info"));

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Clan Emblem")));

        clanEmblemLabel.setIcon(new javax.swing.JLabel() {
            public javax.swing.Icon getIcon() {
                try {
                    return new javax.swing.ImageIcon(
                        new java.net.URL("https://bh-elite-ugc.s3.amazonaws.com/emblem/dev/PS3/635731.png?7023512344859998446")
                    );
                } catch (java.net.MalformedURLException e) {
                }
                return null;
            }
        }.getIcon());

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(clanEmblemLabel)
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(clanEmblemLabel)
        );

        clanStatsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Clan Stats"));

        clanExpLabel.setText("Exp:");

        clanExpToNextLevelLabel.setText("Exp To Next Level:");

        clanHoursPlayedLabel.setText("Hours Played:");

        clanKillDeathRatioLabel.setText("K/Dr (Kill Death Ratio):");

        clanMemberCountLabel.setText("Members:");

        jLabel7.setText("Next/Current Clan Op:");
        jLabel7.setEnabled(false);

        clanLevelLabel.setText("Level:");

        clanOwnerLabel.setText("Clan Owner:");

        clanCreatorLabel.setText("Clan Creator:");

        clanNameLabel.setText("Clan Name:");

        clanTagLabel.setText("Clan Tag:");

        clanMottoLabel.setText("Clan Motto:");

        javax.swing.GroupLayout clanStatsPanelLayout = new javax.swing.GroupLayout(clanStatsPanel);
        clanStatsPanel.setLayout(clanStatsPanelLayout);
        clanStatsPanelLayout.setHorizontalGroup(
            clanStatsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(clanStatsPanelLayout.createSequentialGroup()
                .addGap(11, 11, 11)
                .addGroup(clanStatsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(clanCreatorLabel)
                    .addComponent(clanOwnerLabel)
                    .addComponent(clanLevelLabel)
                    .addComponent(clanMemberCountLabel)
                    .addComponent(clanKillDeathRatioLabel)
                    .addComponent(clanHoursPlayedLabel)
                    .addComponent(clanExpLabel)
                    .addComponent(clanExpToNextLevelLabel))
                .addGap(58, 58, 58)
                .addGroup(clanStatsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(clanTagLabel)
                    .addComponent(clanNameLabel)
                    .addComponent(clanMottoLabel))
                .addContainerGap(224, Short.MAX_VALUE))
            .addGroup(clanStatsPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel7)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        clanStatsPanelLayout.setVerticalGroup(
            clanStatsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(clanStatsPanelLayout.createSequentialGroup()
                .addGroup(clanStatsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(clanLevelLabel)
                    .addComponent(clanTagLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(clanStatsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(clanExpLabel)
                    .addComponent(clanNameLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(clanStatsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(clanExpToNextLevelLabel)
                    .addComponent(clanMottoLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(clanHoursPlayedLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(clanKillDeathRatioLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(clanMemberCountLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(clanOwnerLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(clanCreatorLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel7)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Member Info"));

        jTable1.setModel(model);
        jScrollPane1.setViewportView(jTable1);

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1)
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(clanStatsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(clanStatsPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        jMenuBar1.setBorder(null);

        jMenu1.setText("File");
        jMenuBar1.add(jMenu1);

        jMenu2.setText("Edit");
        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-711)/2, (screenSize.height-499)/2, 711, 499);
    }// </editor-fold>//GEN-END:initComponents

	private void setMemberInfo()
	{
		model.addColumn("PSN");
		model.addColumn("Prestige");
		model.addColumn("Level");
		model.addColumn("K/Dr");
		model.addColumn("Hours Played");
		model.addColumn("Current Exp");
		model.addColumn("Exp To Next Level");
		model.addColumn("Win Percentage");
		model.addColumn("Premium");
		for (member mem : members.getMembers())
		{
			model.addRow(new Object[]{mem.getPSN(), mem.getPrestige(), mem.getLevel(), mem.getKillDeathRatio(), mem.getHoursPlayed(), mem.getExp(), mem.getExpToNextLevel(), mem.getWinPercentage(), mem.isPremium()});
		}
	}
	
	
	private void getClanInfo()
	{
		
		clanLevelLabel.setText(clanLevelLabel.getText() + " " + Integer.toString(clan.getLevel()));
		clanExpLabel.setText(clanExpLabel.getText() + " " + Integer.toString(clan.getExp()));
		clanHoursPlayedLabel.setText(clanHoursPlayedLabel.getText() + " " + Integer.toString(
				clan.getHoursPlayed()));
		clanExpToNextLevelLabel.setText(clanExpToNextLevelLabel.getText() + " " + Integer.toString(
				clan.getExpToNextLevel()));
		clanKillDeathRatioLabel.setText(clanKillDeathRatioLabel.getText() + " " + Double.toString(
				clan.getKillDeathRatio()));
		clanMemberCountLabel.setText(clanMemberCountLabel.getText() + " " + Integer.toString(
				members.getMemberCount()));
		clanOwnerLabel.setText(clanOwnerLabel.getText() + " " + clan.getClanOwner());
		clanCreatorLabel.setText(clanCreatorLabel.getText() + " " + clan.getClanCreator());
		clanTagLabel.setText(clanTagLabel.getText() + " " + clan.getClanTag());
		clanNameLabel.setText(clanNameLabel.getText() + " " + clan.getClanName());
		clanMottoLabel.setText(clanMottoLabel.getText() + " " + clan.getMotto());
	}
	
	
	
	/**
	 * @param args the command line arguments
	 */
	public static void main(String args[]) {
		/*
		 * Set the Nimbus look and feel
		 */
		//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
		 * If Nimbus (introduced in Java SE 6) is not available, stay with the default look and
		 * feel. For details see
		 * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
		 */
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
//			for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//				if ("Nimbus".equals(info.getName())) {
//					javax.swing.UIManager.setLookAndFeel(info.getClassName());
//					break;
//				}
//			}
		} catch (ClassNotFoundException ex) {
			java.util.logging.Logger.getLogger(MainApplication.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
		} catch (InstantiationException ex) {
			java.util.logging.Logger.getLogger(MainApplication.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
		} catch (IllegalAccessException ex) {
			java.util.logging.Logger.getLogger(MainApplication.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
		} catch (javax.swing.UnsupportedLookAndFeelException ex) {
			java.util.logging.Logger.getLogger(MainApplication.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
		}
		//</editor-fold>

		/*
		 * Create and display the form
		 */
		java.awt.EventQueue.invokeLater(new Runnable() {

			public void run() {
				new MainApplication().setVisible(true);
			}
		});
	}
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel clanCreatorLabel;
    private javax.swing.JLabel clanEmblemLabel;
    private javax.swing.JLabel clanExpLabel;
    private javax.swing.JLabel clanExpToNextLevelLabel;
    private javax.swing.JLabel clanHoursPlayedLabel;
    private javax.swing.JLabel clanKillDeathRatioLabel;
    private javax.swing.JLabel clanLevelLabel;
    private javax.swing.JLabel clanMemberCountLabel;
    private javax.swing.JLabel clanMottoLabel;
    private javax.swing.JLabel clanNameLabel;
    private javax.swing.JLabel clanOwnerLabel;
    private javax.swing.JPanel clanStatsPanel;
    private javax.swing.JLabel clanTagLabel;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    // End of variables declaration//GEN-END:variables
}
